""" 
Created the 2013-08-31 14:24 

@author:
"""
from libatomism import *
import matplotlib.pyplot as plt

class msVisu1D( msTreeMapper ):
    """
    msVisu1D documentation
    """
    def __init__(self):
        super( msVisu1D , self).__init__()
        self.constructVar("msVisu1D","msvisu1d","msvisu1d");

    def initialize(self):
        """ declare and initialize childs and attributes of the object.
        See msTreeMapper documentation.
        """
        super(msVisu1D, self).initialize()
        self.sampling = 100
        # add your declarations
     
    def update(self):
        
        """ update childs and attributes of the object, when then internal
        state of self is changed.
        See msTreeMapper documentation.
        """
        super(msVisu1D, self).update()
        # update your variables
        
    @staticmethod
    def New(  ):
        """
        New(  ) -> msTreeMapper
        method New documentation
        
        """
        Self = msVisu1D()
        Self.initialize()
        Self.update()
        return Self
        

    def plot(self,fct,indice):
        """
        plot(  (msVisu1D)self , (msScalarFunction)fct , (int)indice , (int)sampling ) -> msTreeMapper
        plot the function
        """
        x = fct.getXSample1d( int(str(indice)),int(str(sampling)) )
        y = fct.getYSample1d( int(str(indice)),int(str(sampling)) )

        plt.plot(x,y)
        plt.show()
        return self